import axios from "axios";
import React from "react";

export default class FelcUser extends React.Component {
    state = {
        user: {}
    }
    getUser() {
        const id = this.props.id
        console.log(id)

        axios.get(`https://xiaozhu.run/api/user/${id}`).then(res => {
            console.log(res)
            this.setState({ user: res.data.data })
        })
    }
    componentDidMount() {
        this.getUser()
    }
    render() {
        const { user } = this.state
        console.log(user)
        return (
            <>
                <div>
                    <p>ID:{user.id}</p>
                    <p>Username:{user.username}</p></div>
            </>
        )
    }
}